package apps.softtech.Model;

import android.content.ContentValues;
import android.database.Cursor;

public class Offer {
	public int getOfferId() {
		return offerId;
	}
	public void setOfferId(int offerId) {
		this.offerId = offerId;
	}
	public String getOfferPrice() {
		return offerPrice;
	}
	public void setOfferPrice(String offerPrice) {
		this.offerPrice = offerPrice;
	}
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public int getProductId() {
		return productId;
	}
	public void setProductId(int productId) {
		this.productId = productId;
	}
	public String getCreatedDate() {
		return createdDate;
	}
	public void setCreatedDate(String createdDate) {
		this.createdDate = createdDate;
	}
	public int getIsApply() {
		return isApply;
	}
	public void setIsApply(int isApply) {
		this.isApply = isApply;
	}
	public static final String TABLE_NAME = "FollowUser";
	
	public static final String OFFER_ID = "st_OfferId";
	private int offerId;
	
	public static final String OFFER_PRICE = "st_OfferPrice";
	private String offerPrice;
	
	public static final String USERID = "st_UserId";
	private int userId;
	
	public static final String PRODUCT_ID = "st_ProductId";
	private int productId;
	
	public static final String CREATED_DATE = "st_CreatedDate";
	private String createdDate;
	
	public static final String ISAPPLY = "st_IsApply";
	private int isApply;
	public Offer() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Offer(int offerId, String offerPrice, int userId, int productId,
			String createdDate, int isApply) {
		super();
		this.offerId = offerId;
		this.offerPrice = offerPrice;
		this.userId = userId;
		this.productId = productId;
		this.createdDate = createdDate;
		this.isApply = isApply;
	}
	public Offer(String offerPrice, int userId, int productId,
			String createdDate, int isApply) {
		super();
		this.offerPrice = offerPrice;
		this.userId = userId;
		this.productId = productId;
		this.createdDate = createdDate;
		this.isApply = isApply;
	}
	
	/**
	 * get value offer
	 * @author MUI
	 * @return
	 */
	public ContentValues getValueOffer(){
		ContentValues values = new ContentValues();
		values.put(OFFER_PRICE, this.getOfferPrice());
		values.put(USERID, this.getUserId());
		values.put(PRODUCT_ID, this.getProductId());
		values.put(CREATED_DATE, this.getCreatedDate());
		values.put(ISAPPLY, this.getIsApply());
		return values;
		
	}
	public void setValueFromCursor(Cursor c) {
		Offer offer = new Offer();
		if(c.getColumnIndex(OFFER_ID)>=0){
			setOfferId(c.getInt(c.getColumnIndex(OFFER_ID)));
		}
		if(c.getColumnIndex(CREATED_DATE)>=0){
			setCreatedDate(c.getString(c.getColumnIndex(CREATED_DATE)));
		}
		if(c.getColumnIndex(PRODUCT_ID)>=0){
			setProductId(c.getInt(c.getColumnIndex(PRODUCT_ID)));
		}
		if(c.getColumnIndex(OFFER_PRICE)>=0){
			setOfferPrice(c.getString(c.getColumnIndex(OFFER_PRICE)));
		}
		if(c.getColumnIndex(USERID)>=0){
			setUserId(c.getInt(c.getColumnIndex(USERID)));
		}
		if(c.getColumnIndex(ISAPPLY)>=0){
			setUserId(c.getInt(c.getColumnIndex(ISAPPLY)));
		}
	}
	
}
